#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Project : audit
@File : Apache_rules.py
@Author : 陳
@Time : 2025/11/3 11:28
@脚本说明 :
"""

AUDIT_TYPES = {
    "windows": {
        "description": "Windows系统安全审计",
        "module": "Windows_rules",  # 对应Windows_rules.py模块
        "class_name": "WindowsAuditRules",  # 规则类名
        "rules": [
            "check_password_policy",
            "check_user_accounts",
            "check_administrator_group",
            "check_audit_logs",
            "check_backup_status",
            "check_updates_status",
            "check_services_and_ports",
            "check_scheduled_tasks",
            "check_firewall_status",
            "check_autostart_and_registry_hijack"  # 新增：注册表/自启项检测规则
        ]
    },
    "linux": {
        "description": "Linux系统安全审计",
        "module": "Linux_rules",  # 对应Linux_rules.py模块
        "class_name": "LinuxAuditRules",  # 规则类名
        "rules": [
            "check_password_policy",
            "check_sudo_su_permissions",
            "check_suid_files",
            "check_autostart_services",
            "check_high_risk_ports",
            "check_cron_jobs",
            "check_backdoor_files",
            "check_hids_status",
            "check_firewall_status",
            "check_history_commands",
            "check_system_logs",
            "check_sshd_security"
        ]
    },
    "nginx": {
        "description": "Nginx服务安全审计",
        "module": "Nginx_rules",  # 对应你的Nginx规则模块文件（假设文件名是Nginx_rules.py）
        "class_name": "NginxSecurityRules",  # 你的Nginx规则类名
        "rules": [
            "check_directory_listing",
            "check_version_hiding",
            "check_minimal_permissions",
            "check_log_audit",
            "check_data_backup",
            "check_maintenance_patches"
        ]
    },
    "tomcat": {
        "description": "Tomcat服务安全审计",
        "module": "Tomcat_rules",  # 对应Tomcat规则模块文件
        "class_name": "TomcatSecurityRules",  # Tomcat规则类名
        "rules": [
            "check_strong_password",
            "check_minimal_permissions",
            "check_log_audit",
            "check_data_backup",
            "check_maintenance_patches",
            "check_directory_listing"
        ]
    },
    "apache": {
        "description": "XAMPP环境下Apache服务安全审计",
        "module": "Apache_rules",  # 对应Apache规则模块文件
        "class_name": "ApacheXAMPPSecurityRules",  # XAMPP环境下的Apache规则类名
        "rules": [
            "check_non_root_user",
            "check_strong_password",
            "check_minimal_permissions",
            "check_log_audit",
            "check_data_backup",
            "check_maintenance_patches",
            "check_version_hiding"
        ]
    },
"mysql": {
        "module": "Mysql_rules",  # 对应Mysql_rule.py模块
        "class_name": "MySQLAuditRules",
        "description": "MySQL数据库安全配置审计",
        "rules": [
            "check_password_policy",
            "check_user_accounts",
            "check_network_config",
            "check_ssl_config",
            "check_audit_logging",
            "check_file_permissions",
            "check_plugin_security",
            "check_version_security"
        ]
    },

    "redis": {
        "module": "Redis_rules",
        "class_name": "RedisAuditRules",
        "description": "Redis数据库安全配置审计",
        "rules": [
            "check_authentication",
            "check_network_security",
            "check_dangerous_commands",
            "check_acl_configuration",
            "check_persistence_config",
            "check_memory_config",
            "check_logging_config",
            "check_connection_security"
        ]
    }
}